package com.tongji.showroom
{
	import com.tongji.showroom.command.AddImagesCommand;
	import com.tongji.showroom.command.AddUserProductCommand;
	import com.tongji.showroom.command.AddUserSceneCommand;
	import com.tongji.showroom.command.GetSystemSceneCommand;
	import com.tongji.showroom.command.GetUserSceneCommand;
	import com.tongji.showroom.command.ReleaseProductCommand;
	import com.tongji.showroom.command.SearchSceneCommand;
	import com.tongji.showroom.command.TypeCommand;
	import com.tongji.showroom.events.AddImageEvent;
	import com.tongji.showroom.events.AddUserProductEvent;
	import com.tongji.showroom.events.AddUserSceneEvent;
	import com.tongji.showroom.events.GetSystemSceneEvent;
	import com.tongji.showroom.events.GetTypesEvent;
	import com.tongji.showroom.events.GetUserSceneEvent;
	import com.tongji.showroom.events.ReleaseProductEvent;
	import com.tongji.showroom.events.SearchSceneEvent;
	import com.tongji.showroom.model.FurnitureModel;
	import com.tongji.showroom.model.GetSystemSceneModel;
	import com.tongji.showroom.model.GetUserSceneModel;
	import com.tongji.showroom.model.Picture3DModel;
	import com.tongji.showroom.model.PictureModel;
	import com.tongji.showroom.model.SearchSceneModel;
	import com.tongji.showroom.model.TestModel;
	import com.tongji.showroom.model.TypeModel;
	import com.tongji.showroom.model.UserModel;
	import com.tongji.showroom.model.UserProductModel;
	import com.tongji.showroom.model.UserSceneModel;
	import com.tongji.showroom.service.GetSystemSceneService;
	import com.tongji.showroom.service.SearchSceneService;
	import com.tongji.showroom.service.TypeService;
	import com.tongji.showroom.service.UserProductService;
	import com.tongji.showroom.service.UserSceneService;
	import com.tongji.showroom.view.FirstStepComp;
	import com.tongji.showroom.view.FirstStepCompMediator;
	import com.tongji.showroom.view.FirstStepTaggingComp;
	import com.tongji.showroom.view.FirstStepTaggingCompMediator;
	import com.tongji.showroom.view.FirstStepUploadLeftComp;
	import com.tongji.showroom.view.FirstStepUploadLeftCompMediator;
	import com.tongji.showroom.view.FirstStepUploadRightComp;
	import com.tongji.showroom.view.FirstStepUploadRightCompMediator;
	import com.tongji.showroom.view.PageComp;

	import com.tongji.showroom.view.ReleaseScenceMediator;
	import com.tongji.showroom.view.ReleaseSenceComp;
	import com.tongji.showroom.view.SecondLayerEditPointDataListItemRenderer;
	import com.tongji.showroom.view.SecondLayerEditPointDataListItemRendererMediator;
	import com.tongji.showroom.view.SecondStepComp;
	import com.tongji.showroom.view.SecondStepEditSceneComp;
	import com.tongji.showroom.view.SecondStepEditSceneMediator;
	import com.tongji.showroom.view.SecondStepSelectSenceComp;
	import com.tongji.showroom.view.SecondStepSelectSenceMediator;
	import com.tongji.showroom.view.SelectSenceDataListItemRenderer;
	import com.tongji.showroom.view.SelectedFurnitureDataListItemRenderer;
	import com.tongji.showroom.view.SelectedFurnitureItemRendererMediator;
	import com.tongji.showroom.view.ThirdStepComp;
	import com.tongji.showroom.view.ThirdStepMediator;
	import com.tongji.showroom.view.WorkComp;
	import com.tongji.showroom.view.WorkCompMediator;
	import com.tongji.showroom.view.titleWindows.FilterTitleWinMediator;
	import com.tongji.showroom.view.titleWindows.FilterTitleWindow;
	import com.tongji.showroom.view.titleWindows.PreviewTitleWindow;
	import com.tongji.showroom.view.titleWindows.SingleFurnitureTitleWindow;
	import com.tongji.showroom.view.titleWindows.SingleFurnitureTitleWindowMediator;
	
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.mvcs.Context;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/7/11
	 */
	
	public class ShowRoomContext extends Context
	{
		public function ShowRoomContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void
		{			
			//Model
			//injector.mapSingleton(TestModel);
			injector.mapSingleton(PictureModel);//chenzhongyuan
			injector.mapSingleton(Picture3DModel);//xxj
			injector.mapSingleton(TypeModel);//jiarong
			injector.mapSingleton(UserProductModel);//jiarong
			injector.mapSingleton(SearchSceneModel);//jiarong
			injector.mapSingleton(GetSystemSceneModel);//jairong
			injector.mapSingleton(UserSceneModel);//frank
			injector.mapSingleton(FurnitureModel); //caddy
			injector.mapSingleton(GetUserSceneModel);
			injector.mapSingleton(UserModel);

			//Service
			injector.mapSingleton(TypeService);//jiarong
			injector.mapSingleton(UserProductService);//jiarong
			injector.mapSingleton(UserSceneService);
			injector.mapSingleton(GetSystemSceneService);
			injector.mapSingleton(SearchSceneService);
			//mapView
			mediatorMap.mapView(SelectedFurnitureDataListItemRenderer, SelectedFurnitureItemRendererMediator);//caddy
            mediatorMap.mapView(WorkComp, WorkCompMediator);//caddy			
			mediatorMap.mapView(FirstStepUploadLeftComp, FirstStepUploadLeftCompMediator); //chenzhongyuan
			mediatorMap.mapView(FirstStepUploadRightComp, FirstStepUploadRightCompMediator); 
			mediatorMap.mapView(SecondStepEditSceneComp, SecondStepEditSceneMediator);
			mediatorMap.mapView(SecondLayerEditPointDataListItemRenderer, SecondLayerEditPointDataListItemRendererMediator);
			mediatorMap.mapView(SingleFurnitureTitleWindow, SingleFurnitureTitleWindowMediator);//chenzhongyuan
			mediatorMap.mapView(FirstStepTaggingComp,FirstStepTaggingCompMediator);//xxj
			mediatorMap.mapView(SecondStepSelectSenceComp, SecondStepSelectSenceMediator);//jiarong
			mediatorMap.mapView(ReleaseSenceComp,ReleaseScenceMediator);//jiarong

			mediatorMap.mapView(ThirdStepComp, ThirdStepMediator);//caddy
			mediatorMap.mapView(FirstStepComp, FirstStepCompMediator);
			mediatorMap.mapView(FilterTitleWindow, FilterTitleWinMediator, null, false, false);
			//mapEvent 
			commandMap.mapEvent(GetSystemSceneEvent.GET_ALL_SCENE, GetSystemSceneCommand);
			commandMap.mapEvent(GetSystemSceneEvent.UPDATE_ALL_SCENE, GetSystemSceneCommand);
			
			commandMap.mapEvent(GetTypesEvent.GET_PLACES, TypeCommand);
			commandMap.mapEvent(GetTypesEvent.UPADATE_PLACES,TypeCommand);
			commandMap.mapEvent(GetTypesEvent.GET_STYLES,TypeCommand);
			commandMap.mapEvent(GetTypesEvent.UPDATE_STYLES,TypeCommand);
			commandMap.mapEvent(AddUserProductEvent.ADD_USER_PRODUCT, AddUserProductCommand);
			
			commandMap.mapEvent(SearchSceneEvent.SEARCH_ALL_SCENES, SearchSceneCommand);
			commandMap.mapEvent(SearchSceneEvent.UPDATE_SCENES, SearchSceneCommand);
			commandMap.mapEvent(SearchSceneEvent.DRAG_ROOM, SearchSceneCommand);
			//commandMap.mapEvent(AddUserProductEvent.GET_USER_PRODUCT, AddUserProductCommand);
			
			commandMap.mapEvent(AddUserProductEvent.GET_USER_PRODUCT, AddUserProductCommand);
			commandMap.mapEvent(AddUserProductEvent.UPDATE_USER_MODEL, AddUserProductCommand);
			commandMap.mapEvent(AddUserProductEvent.DELETE_USER_PRODUCT, AddUserProductCommand);
			commandMap.mapEvent(AddUserProductEvent.DELETE_A_PICTURE, AddUserProductCommand);
			
			commandMap.mapEvent(GetUserSceneEvent.GET_USER_SCENE, GetUserSceneCommand);
			commandMap.mapEvent(GetUserSceneEvent.UPDATE_USER_SCENE, GetUserSceneCommand);
			
			/*commandMap.mapEvent(AddUserSceneEvent.UPDATE_USER_SCENE, AddUserSceneCommand);*///caddy
			commandMap.mapEvent(AddImageEvent.ADD_IMAGES, AddImagesCommand);
			commandMap.mapEvent(AddImageEvent.UPDATE_IMAGE, AddImagesCommand);

			
			commandMap.mapEvent(AddUserSceneEvent.ADD_USER_SCENE, AddUserSceneCommand);
			

			
			commandMap.mapEvent(ReleaseProductEvent.RELEASE_A_PRODUCT, ReleaseProductCommand);//czy
		}
	}
}